package com.zhangxiaofanfan.hotcode.first;

/**
 * <a href="https://leetcode.cn/problems/single-number/description/?envType=study-plan-v2&envId=top-100-liked">136. 只出现一次的数字</a>
 *
 * @date 2024-07-13 03:14:13
 * @author zhangxiaofanfan
 */
public class HotCode096 {
    public static void main(String[] args) {
        HotCode096 hotCode = new HotCode096();
        int[] nums = {1,1,2,2,3};
        System.out.println(hotCode.singleNumber(nums));
    }

    public int singleNumber(int[] nums) {
        int result = 0;
        for (int num : nums) {
            result = result ^ num;
        }
        return result;
    }
}